home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / trayx / trayxsmp.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1997-10-21  |  5.3 KB  |  169 lines

  1. VERSION 4.00
  2. Begin VB.Form TrayXSample 
  3.    BorderStyle     =   1  'Fixed Single
  4.    Caption         =   "Tray/X Control Sample"
  5.    ClientHeight    =   4110
  6.    ClientLeft      =   2130
  7.    ClientTop       =   2040
  8.    ClientWidth     =   7800
  9.    Height          =   4515
  10.    Icon            =   "trayxsmp.frx":0000
  11.    Left            =   2070
  12.    LinkTopic       =   "Form1"
  13.    MaxButton       =   0   'False
  14.    ScaleHeight     =   4110
  15.    ScaleWidth      =   7800
  16.    Top             =   1695
  17.    Width           =   7920
  18.    Begin VB.ListBox lstLog 
  19.       Height          =   2790
  20.       Left            =   240
  21.       TabIndex        =   3
  22.       Top             =   1080
  23.       Width           =   3495
  24.    End
  25.    Begin VB.TextBox txtTooltip 
  26.       Height          =   285
  27.       Left            =   240
  28.       TabIndex        =   1
  29.       Top             =   480
  30.       Width           =   3495
  31.    End
  32.    Begin VB.CommandButton Command1 
  33.       Caption         =   "Hide Icon"
  34.       Height          =   495
  35.       Left            =   5520
  36.       TabIndex        =   0
  37.       Top             =   240
  38.       Width           =   1935
  39.    End
  40.    Begin VB.Label Label5 
  41.       AutoSize        =   -1  'True
  42.       Caption         =   $"trayxsmp.frx":030A
  43.       Height          =   1365
  44.       Left            =   3960
  45.       TabIndex        =   7
  46.       Top             =   2505
  47.       Width           =   3495
  48.       WordWrap        =   -1  'True
  49.    End
  50.    Begin VB.Label Label4 
  51.       AutoSize        =   -1  'True
  52.       Caption         =   $"trayxsmp.frx":0432
  53.       Height          =   780
  54.       Left            =   3960
  55.       TabIndex        =   6
  56.       Top             =   1635
  57.       Width           =   3495
  58.       WordWrap        =   -1  'True
  59.    End
  60.    Begin VB.Label Label3 
  61.       AutoSize        =   -1  'True
  62.       Caption         =   "This sample shows how to use the Mabry Software Tray/X control.  Tray/X is a light ActiveX control."
  63.       Height          =   585
  64.       Left            =   3960
  65.       TabIndex        =   5
  66.       Top             =   960
  67.       Width           =   3495
  68.       WordWrap        =   -1  'True
  69.    End
  70.    Begin VB.Label Label2 
  71.       BackStyle       =   0  'Transparent
  72.       Caption         =   "Tray Icon Event Log:"
  73.       Height          =   255
  74.       Left            =   240
  75.       TabIndex        =   4
  76.       Top             =   840
  77.       Width           =   1815
  78.    End
  79.    Begin VB.Label Label1 
  80.       BackStyle       =   0  'Transparent
  81.       Caption         =   "Tool Tip Text:"
  82.       Height          =   255
  83.       Left            =   240
  84.       TabIndex        =   2
  85.       Top             =   240
  86.       Width           =   2775
  87.    End
  88.    Begin MTRAYXLibCtl.TrayX TrayX1 
  89.       Left            =   4920
  90.       Top             =   240
  91.       _ExtentX        =   847
  92.       _ExtentY        =   847
  93.       ToolTipText     =   "Mabry Toolman Logo"
  94.       Visible         =   0   'False
  95.       Icon            =   "trayxsmp.frx":04F2
  96.    End
  97. Attribute VB_Name = "TrayXSample"
  98. Attribute VB_Creatable = False
  99. Attribute VB_Exposed = False
  100. Option Explicit
  101. Private Sub Command1_Click()
  102.    ' Is the icon currently visible?
  103.    If TrayX1.IconVisible Then
  104.       ' If so, hide it and change the command
  105.       ' button's text to reflect the current
  106.       ' state.
  107.       TrayX1.IconVisible = False
  108.       Command1.Caption = "Show Icon"
  109.    Else
  110.       ' If not, show it and change the command
  111.       ' button's text to reflect the current
  112.       ' state.
  113.       TrayX1.IconVisible = True
  114.       Command1.Caption = "Hide Icon"
  115.    End If
  116. End Sub
  117. Private Sub Form_Load()
  118.    ' Set up controls and icon.
  119.    txtTooltip.Text = TrayX1.ToolTipText
  120.    TrayX1.IconVisible = True
  121. End Sub
  122. Private Sub Form_Resize()
  123.     If Me.WindowState = vbMinimized Then
  124.         Me.Visible = False
  125.     Else
  126.         Me.Visible = True
  127.     End If
  128. End Sub
  129. Private Sub TrayX1_Click()
  130.    ' Log this event
  131.    lstLog.AddItem "Click"
  132.    lstLog.ListIndex = lstLog.ListCount - 1
  133. End Sub
  134. Private Sub TrayX1_DblClick()
  135.     If Me.WindowState = vbMinimized Then
  136.         Me.WindowState = vbNormal
  137.         Me.Visible = True
  138.     End If
  139.    ' Log this event
  140.    lstLog.AddItem "DblClick"
  141.    lstLog.ListIndex = lstLog.ListCount - 1
  142. End Sub
  143. Private Sub TrayX1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  144.    ' Log this event
  145.    lstLog.AddItem "MouseDown (" & X & "," & Y & ") button=" & Button & " shift=" & Shift
  146.    lstLog.ListIndex = lstLog.ListCount - 1
  147. End Sub
  148. Private Sub TrayX1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  149.    ' Log this event
  150.    lstLog.AddItem "MouseMove (" & X & "," & Y & ") button=" & Button & " shift=" & Shift
  151.    lstLog.ListIndex = lstLog.ListCount - 1
  152. End Sub
  153. Private Sub TrayX1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
  154.    ' Log this event
  155.    lstLog.AddItem "MouseUp (" & X & "," & Y & ") button=" & Button & " shift=" & Shift
  156.    lstLog.ListIndex = lstLog.ListCount - 1
  157. End Sub
  158. Private Sub TrayX1_RightClick()
  159.    ' Log this event
  160.    lstLog.AddItem "RightClick"
  161.    lstLog.ListIndex = lstLog.ListCount - 1
  162. End Sub
  163. Private Sub txtTooltip_Change()
  164.    ' When the user changes the text in this
  165.    ' edit box, change the text displayed
  166.    ' over the icon in the tray.
  167.    TrayX1.ToolTipText = txtTooltip.Text
  168. End Sub
  169.